from middleware import MiddleWare
from myhttp import HttpResponseServerError


class CsrfMiddleWare(MiddleWare):
    def process_request(self, request):
        if request.method == "POST":
            print(request.POST)
            if "csrf_token" not in request.POST:
                return HttpResponseServerError

            # TODO: add code to validate the CSRF token.
            # if request.GET['csrf_token'] != "DFSDFDSFSDF":
            #    return HttpResponseServerError
            #
    def process_response(self, response):
        pass
